#include<iostream>
#include<string>
#include<vector>
using namespace std;

bool isAnagram(string s, string t) {
    if(s.size() != t.size()) return false;

    vector<int>count(26,0);
    for(int i=0;i<s.size();i++){
        count[s[i]-'a'] += 1;
        count[t[i]-'a'] -= 1;
    }

    for(int i=0;i<26;i++) if(count[i] != 0) return false;
    return true;
}

int main()
{
    string s = "anagram";
    string t = "nagaram";

    cout << isAnagram(s,t) << endl;
    return 0;
}

